package com.java.base.javabase.thread.pool.dataSummary.demo1;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * 线程类
 */
public class TaskDemo {
    public static void main(String[] args) {
        try {
            List<Integer> splitList = new ArrayList<Integer>();
            for(int i=0;i<100;i++){
                splitList.add(i);
            }


            TaskThread<Integer,Integer> multiThread = new TaskThread<Integer,Integer>(splitList){
                @Override
                public Integer outExecute(int currentThread, Integer data) {
                    System.out.println("当前线程号="+currentThread+" data="+data);
                    return data*2;
                }
            };
            List<Integer> list = multiThread.getResult();
            //获取每一批次处理结果
            System.out.println("获取处理结果........................");
            for(Integer vo:list){
                System.out.println(vo);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}

